package com.mayjean.redis.config;

import com.mayjean.redis.lock.RedisLockService;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * @author
 */
@Configuration
@AutoConfigureAfter(RedisTemplateConfiguration.class)
@Import(RedisTemplateConfiguration.class)
@ConditionalOnProperty(prefix = "nezha.starters", name = "redis", havingValue = "true")
class RedisLockConfiguration {

	@Bean("redisLock")
	public RedisLockService redisLock(RedisTemplate<String, Object> redisTemplate) {
		return new RedisLockService(redisTemplate);
	}
}
